package org.tourism.service.impl;

import org.tourism.entity.Room;
import org.tourism.mapper.RoomMapper;
import org.tourism.service.RoomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wuling
 * @since 2024-07-05
 */
@Service
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements RoomService {

    private RoomMapper roomMapper;
    @Override
    public int addRoom(Room room) {
        return roomMapper.insert(room);
    }

    @Override
    public int updateRoom(Room room) {
        return roomMapper.updateById(room);
    }

    @Override
    public int deleteRoomById(int id) {
        return roomMapper.deleteById(id);
    }

    @Override
    public Room getRoomById(int id) {
        return roomMapper.selectById(id);
    }

    @Override
    public List<Room> getAllRooms() {
        return roomMapper.selectList(null);
    }
}
